//
// Created by xili on 2024/8/13 19:40.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    void duplicateZeros(vector<int> &arr) {
        int n = arr.size();
        for (int i = 0; i < n; i++) {
            if (!arr[i] && i + 1 < n) {
                for (int j = n - 2; j >= i + 1; j--) {
                    arr[j + 1] = arr[j];
                }
                arr[++i] = 0;
            }
        }
    }
};